<?php
// +----------------------------------------------------------------------
// | sfadmin - Suifeng Administration
// +----------------------------------------------------------------------
// | Copyright (c) 2017-2020 http://suifeng.tech All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: suifeng <1787585212@qq.com>
// +----------------------------------------------------------------------

namespace app\admin\controller;

use app\admin\common\AdminController;

class System extends AdminController
{
    public function checkVersion()
    {
        //         //远程更新地址
        //         $url = config('WEBSITE_DOMAIN') . config('UPDATE_URL') . '.html?action=check';

        //         //参数设置
        //         $params = array(
        //             //系统信息
        //             'product_name'    => config('PRODUCT_NAME'),
        //             'current_version' => config('CURRENT_VERSION'),
        //             'company_name'    => config('COMPANY_NAME'),
        //             'develop_version' => config('DEVELOP_VERSION'),
        //             'build_version'   => config('BUILD_VERSION'),
        //             'product_model'   => config('MODEL_NAME'),
        //             'product_title'   => config('PRODUCT_TITLE'),
        //             'develop_team'    => config('DEVELOP_TEAM'),

        //             //用户信息
        //             'data_auth_key'   => sha1(config('DATA_AUTH_KEY')),
        //             'website_domain'  => $_SERVER['HTTP_HOST'],
        //             'server_software' => php_uname() . '_' . $_SERVER['SERVER_SOFTWARE'],
        //             'website_title'   => config('WEB_SITE_TITLE'),
        //             'auth_sn'         => config('AUTH_SN'),
        //             'autn_username'   => config('AUTH_USERNAME'),
        //             'autn_password'   => config('AUTH_PASSWORD'),
        //         );
        //         $vars = http_build_query($params);

        //         //获取版本数据
        //         $conf_arr = array(
        //             'post' => $params,
        //         );
        //         $result = json_decode(\suifeng\Http::fsockopenDownload($url, $conf_arr), true);

        //         if ($result['status'] == 1) {
        //             $this->ajaxReturn($result);
        //         } else {
        //             $this->error('连接服务器失败');
        //         }
    }

    public function phpinfo()
    {
        //
    }

    public function remove_runtime()
    {
        $result = \suifeng\utils\FileUtil::clean_runtime_dir();
        if (!$result) {
            $this->error("缓存清理失败。");
        }
        $this->success("缓存清理成功。");
    }
}